package com.csun.cmny.provider.service.impl;

import com.csun.cmny.core.support.BaseService;
import com.csun.cmny.provider.dao.DmcCsunCameraCmdRecordMapper;
import com.csun.cmny.provider.model.domain.DmcCsunCameraCmdRecord;
import com.csun.cmny.provider.service.DmcCsunCameraCmdRecordService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2020-01-03 14:45
 * @Description:
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class DmcCsunCameraCmdRecordServiceImpl extends BaseService<DmcCsunCameraCmdRecord>
        implements DmcCsunCameraCmdRecordService {

    @Resource
    private DmcCsunCameraCmdRecordMapper dmcCsunCameraCmdRecordMapper;

    /**
     * cmd call back finish
     *
     * @param taskId task id
     * @return the int.
     */
    @Override
    public Integer cmdCallbackFinish(String taskId) {

        Map<String, Object> param = new HashMap<String, Object>();
        param.put("taskId", taskId);
        param.put("affect_rows", -1);

        dmcCsunCameraCmdRecordMapper.callBackFinish(param);

        return (Integer)param.get("affect_rows");
    }
}
